﻿using Abp.Application.Navigation;
using Abp.Localization;
using MyCompanyName.AbpZeroTemplate.Authorization;
using MyCompanyName.AbpZeroTemplate.Web.Navigation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MyCompanyName.AbpZeroTemplate.Web.Areas.Okr.Startup
{
    public class OkrNavigationProvider : NavigationProvider
    {
        //Mpa区域的菜单,各区域area下面的layout取值的时候用到了。

        public const string MenuName = "Okr";

        public override void SetNavigation(INavigationProviderContext context)
        {
            var menu = context.Manager.Menus[MenuName] = new MenuDefinition(MenuName, new FixedLocalizableString("Main Menu"));
            
            var okr = new MenuItemDefinition(
                    PageNames.App.Okr.Daybook,
                    L("Okr.Daybook"),
                    url: "Okr/Home",
                    icon: "icon-globe",
                    requiredPermissionName: null);

            var okr_edit = new MenuItemDefinition(
                    PageNames.App.Okr.Daybook_Edit,
                    L("Okr.Daybook.Edit"),
                    url: "Okr/Daybook/Edit",
                    icon: "icon-globe",
                    requiredPermissionName: null);
            var okr_mylist = new MenuItemDefinition(
                    PageNames.App.Okr.Daybook_My,
                    L("Okr.Daybook.My"),
                    url: "Okr/Daybook/My",
                    icon: "icon-globe",
                    requiredPermissionName: null);
            var okr_manager = new MenuItemDefinition(
                    PageNames.App.Okr.Daybook_Manager,
                    L("Okr.Daybook.Manager"),
                    url: "Okr/Daybook/Manager",
                    icon: "icon-globe",
                    requiredPermissionName: null);



            menu
                .AddItem(
                    okr
                        .AddItem(okr_edit)
                        .AddItem(okr_mylist)
                        .AddItem(okr_manager)
                );
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, AbpZeroTemplateConsts.LocalizationSourceName);
        }
    }
}